package com.awifi.com.thread.method;

/**
 * @description: ToDo
 * @author: marin
 * @time: 2020/6/28 22:16
 */
public class RunableImpl implements Runnable {

    private int ticket = 100;
    Object object = new Object();

    @Override
    public void run() {
        while (true){
           init();
        }
    }
    public synchronized void init(){
        if(ticket>0){
            ticket--;
            System.out.println(Thread.currentThread().getName()+"正在卖第"+ticket+"张票");
        }
    }
}
